win32: Ensure we can create a window for wintab
authorCarlos Garnacho <carlosg@gnome.org>
Mon, 26 Jan 2015 14:26:34 +0000 (14:26 +0000)
committerCarlos Garnacho <carlosg@gnome.org>
Wed, 28 Jan 2015 16:59:29 +0000 (16:59 +0000)
The window used NULL as a parent window, which defaults internally to
using the root window of the default screen. But at the time wintab is
initialized, there is no default display/screen yet.

Fix this by retrieving this information from the given GdkDeviceManager,
so we don't have to wait for the display to be in place before
initialization.

https://bugzilla.gnome.org/show_bug.cgi?id=743330

gdk/win32/gdkdevicemanager-win32.c

index 41433a8770a14b3d9c3a1203421fa328ccbe8d37..a645c105e314f493e50d024307260fa3bcb07d81 100644 (file)
@@ -371,6 +371,8 @@ void
 _gdk_input_wintab_init_check (GdkDeviceManager *_device_manager)
 {
   GdkDeviceManagerWin32 *device_manager = (GdkDeviceManagerWin32 *)_device_manager;
+  GdkDisplay *display = gdk_device_manager_get_display (_device_manager);
+  GdkWindow *root = gdk_screen_get_root_window (gdk_display_get_default_screen (display));
   static gboolean wintab_initialized = FALSE;
   GdkDeviceWintab *device;
   GdkWindowAttr wa;
@@ -459,7 +461,7 @@ _gdk_input_wintab_init_check (GdkDeviceManager *_device_manager)
   wa.x = -100;
   wa.y = -100;
   wa.window_type = GDK_WINDOW_TOPLEVEL;
-  if ((wintab_window = gdk_window_new (NULL, &wa, GDK_WA_X|GDK_WA_Y)) == NULL)
+  if ((wintab_window = gdk_window_new (root, &wa, GDK_WA_X | GDK_WA_Y)) == NULL)
     {
       g_warning ("gdk_input_wintab_init: gdk_window_new failed");
       return;